import java.util.Arrays;
public class Test {
    public static void main(String[] args) {
        int[] arr = {2,1,3};
        System.out.println(Solution.missingNumber(arr));
    }
}
class Solution {
    public static int missingNumber(int[] nums) {
       int[] arr = new int[nums.length + 1];
        for (int i = 0; i < nums.length; i++) {
            arr[nums[i]] = nums[i];
        }
        for (int i = 1; i < arr.length; i++) {
            if(arr[i] == 0) {
                return i;
            }
        }
        return 0;
    }
}